/**
 *
 * @author 朱雀
 */
Ext.define('NG.i6p.ModelTree', {
	extend: 'SvgEditor.module.ModelTree',
	title: 'i6p 12.20 Model',
	initComponent: function() {
		var me = this;
		me.initModel(me);
		me.initTbar(me);
		me.callParent();
	},
	initModel: function(me) {
		me.store = Ext.create('Ext.data.TreeStore', {
			fields: [
				{name: 'id', type: 'string'},
				{name: 'text', type: 'string'},
				{name: 'icon', type: 'string'},
				{name: 'leaf', type: 'bool'},
				{name: 'type', type: 'string'},
				{name: 'view', type: 'string'},
				{name: 'data', type: 'object'},
				{name: 'attrs', type: 'object'}
			],
			proxy: {
				type: 'ajax',
				url: 'model/Model_zh-cn.json',
				reader: {
					type: 'json'
//					root: 'model'
				}
			}
		});
	},
	initTbar: function(me) {
		me.filterField = Ext.create('Ext.form.field.Text', {
			xtype: 'textfield',
			fieldLabel: '筛选',
			labelWidth: 40
		});
		me.filterField.on('change', function() {
			me.filterBy(this.getValue(), 'text');
		});
		me.tbar = Ext.create('Ext.form.Panel', {
			layout: 'fit',
			frame: true,
			items: [me.filterField]
		});
	}
});